/*
This file is part of MMM.

MMM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

MMM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with MMM.  If not, see <http://www.gnu.org/licenses/>.
*
* @package    MMM
* @author     Andre Meixner
* @copyright  2018 High Performance Humanoid Technologies (H2T), Karlsruhe, Germany
*
*/

#ifndef __MMM_SENSORMEASUREMENTTYPE_H_
#define __MMM_SENSORMEASUREMENTTYPE_H_

#include <MMM/MMMImportExport.h>
#include <string>

namespace MMM {

class MMM_IMPORT_EXPORT SensorMeasurementType
{
public:
    enum Value {
        MEASURED, INTERPOLATED, EXTENDED, UNKNOWN
    };

    SensorMeasurementType() = default;
    constexpr SensorMeasurementType(Value value) : value(value) { }

    bool operator==(SensorMeasurementType other) const { return value == other.value; }
    bool operator!=(SensorMeasurementType other) const { return value != other.value; }

    std::string toString() {
        switch (value) {
        case MEASURED:
            return "measured";
            break;
        case INTERPOLATED:
            return "interpolated";
            break;
        case EXTENDED:
            return "extended";
            break;
        default:
            return "unknown";
        }
    }

    static SensorMeasurementType toSensorMeasurementType(const std::string &name) {
        // TODO remove this "bad smell"
        if (name == "measured") return MEASURED;
        else if (name == "interpolated") return INTERPOLATED;
        else if (name == "extended") return EXTENDED;
        else return UNKNOWN;
    }

private:
    Value value;
};

}

#endif // __MMM_SENSORMEASUREMENTTYPE_H_
